/**
 *
 * 用来生成骨骼动画元素的工厂
 *
 */
class AniFactory {

    private static _factory = null;

    public static produce(aniInfoName: string,txtInfoName: string,txtDataName: string,
            aniName: string): dragonBones.FastArmature {

        var aniInfo: any = RES.getRes(aniInfoName),
            txtInfo: any = RES.getRes(txtInfoName),
            txtData: any = RES.getRes(txtDataName),
            armObj: dragonBones.FastArmature;

        if(!this._factory) {
            this._factory = new dragonBones.EgretFactory();
        }

        this._factory.addSkeletonData(dragonBones.DataParser.parseDragonBonesData(aniInfo));
        this._factory.addTextureAtlas(new dragonBones.EgretTextureAtlas(txtData, txtInfo));
        
        armObj = this._factory.buildFastArmature(aniName);
        armObj.enableAnimationCache(30);
        
        dragonBones.WorldClock.clock.add(armObj);
        
        return armObj;
    }
}
